﻿using Ocelot.Logging;
using System;
using System.Collections.Generic;
using System.Text;
using Exceptionless;
using Exceptionless.Logging;

namespace Brc_DSB.GetWay.Exceptionless
{
    public class ExceptionlessLogger: IOcelotLogger
    {
        private string _logInstanceType;
        public ExceptionlessLogger(string logInstanceType)
        {
            _logInstanceType = logInstanceType;
        }
        public void LogCritical(string message, Exception exception)
        {
            ExceptionlessClient.Default.CreateException(exception).AddTags(_logInstanceType).Submit();
        }

        public void LogDebug(string message)
        {
            ExceptionlessClient.Default.CreateLog(message, LogLevel.Debug).AddTags(_logInstanceType).Submit();
        }

        public void LogError(string message, Exception exception)
        {
            ExceptionlessClient.Default.CreateLog(message, LogLevel.Error).AddTags(_logInstanceType).Submit();
        }

        public void LogInformation(string message)
        {
            ExceptionlessClient.Default.CreateLog(message, LogLevel.Info).AddTags(_logInstanceType).Submit();
        }

        public void LogTrace(string message)
        {
            ExceptionlessClient.Default.CreateLog(message, LogLevel.Trace).AddTags(_logInstanceType).Submit();
        }

        public void LogWarning(string message)
        {
            ExceptionlessClient.Default.CreateLog(message, LogLevel.Warn).AddTags(_logInstanceType).Submit();
        }
    }
}
